﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JXPlatform.Infrastructure.Interfaces.GIS;
using Microsoft.Practices.Prism.ViewModel;

namespace JXPlatform.GIS.ViewModels
{
    [Export]
    public class PointViewModel : NotificationObject
    {
        private readonly IPoint _point;
        private readonly IPointService _pointService;

        [ImportingConstructor]
        public PointViewModel(IPointService pointService, IPoint point)
        {
            if (pointService == null)
            {
                throw new ArgumentNullException("pointService");
            }

            if (point == null)
            {
                throw new ArgumentNullException("point");
            }

            _pointService = pointService;
            _point = point;
        }

        public double X
        {
            get { return _point.X; }
            set
            {
                _point.X = value;
                RaisePropertyChanged(()=>X);
            }
        }

        public double Y
        {
            get { return _point.Y; }
            set
            {
                _point.Y = value;
                RaisePropertyChanged(() => Y);
            }
        }
    }
}
